import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from '@/views/Home.vue';
import Details from '@/views/Details.vue';
import Explain from '@/views/Explain.vue';
import Vote from '@/views/Vote.vue';
import Report from '@/views/Report.vue';
import Member from '@/views/Member.vue';
import Roster from '@/views/Roster.vue';
import Review from '@/views/Review.vue';
import Tour from '@/views/Tour.vue';
import People from '@/views/People.vue';
import Upload from '@/views/Upload.vue';
import bookSearch from '@/views/bookSearch/index.vue';
import buildDetails from '@/components/build-details/index.vue';
const _this = new Vue();
Vue.use(VueRouter);
const routes = [
  {
    path: '/',
    name: 'Home',
    meta: {
      pid: 0,
      name: '首页',
      active: '/',
    },
    component: Home,
  },
  {
    path: '/details',
    name: 'Details',
    meta: {
      pid: 0,
      name: '申报规范',
      active: '/details',
    },
    component: Details,
  },
  {
    path: '/bookSearch',
    name: 'bookSearch',
    meta: {
      pid: 1,
      name: '获奖查询结果',
      active: '/bookSearch',
    },
    component: bookSearch,
  },
  // {
  //   path: '/explain',
  //   name: 'Explain',
  //   meta: {
  //     pid: 0,
  //     name: '奖项说明',
  //   },
  //   component: Explain,
  // },
  {
    path: '/vote',
    name: 'Vote',
    meta: {
      pid: 0,
      name: '参选人展示',
      active: '/vote',
    },
    component: Vote,
  },
  {
    path: '/report',
    name: 'Report',
    meta: {
      pid: 0,
      name: '大赛报道',
      active: '/report',
    },
    component: Report,
  },
  {
    path: '/member',
    name: 'Member',
    meta: {
      pid: 0,
      name: '专家委员会',
      active: '/member',
    },
    component: Member,
  },
  {
    path: '/roster',
    name: 'Roster',
    meta: {
      pid: 0,
      name: '往届名单公示',
      active: '/roster',
    },
    component: Roster,
  },
  {
    path: '/review',
    name: 'Review',
    meta: {
      pid: 0,
      name: '往期回顾',
      active: '/review',
    },
    component: Review,
  },
  {
    path: '/tour',
    name: 'Tour',
    meta: {
      pid: 0,
      name: '城市公益巡讲',
      active: '/tour',
    },
    component: Tour,
  },
  {
    path: '/people',
    name: 'People',
    meta: {
      pid: 1,
      name: '参赛人物',
      active: '/people',
    },
    component: People,
  },
  {
    path: '/Upload',
    name: 'Upload',
    meta: {
      pid: 1,
      name: '上传文件',
      active: '/Upload',
    },
    component: Upload,
  },
  {
    path: '/newsDetails',
    name: 'newsDetails',
    meta: {
      pid: 1,
      name: '新闻详情',
      active: '/newsDetails',
    },
    component: buildDetails,
  },
];
const router = new VueRouter({
  mode: 'history',
  routes,
});
router.beforeEach(async (to, from, next) => {
  _this.load();
  next();
  _this.done();
});
export default router;
